package com.zjt.swipeview.util;

import android.app.Activity;
import android.graphics.Point;
import android.view.View;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2017</p>
 * <P>Company: </p>
 *
 * @author zhengjianting
 * @time 2017/11/23 0023 下午 4:43
 */

public class ViewUtil {

    public static boolean isInScreen(Activity activity, View view) {
        Point point = new Point();
        activity.getWindowManager().getDefaultDisplay().getSize(point);
        int screenWidth = point.x;
        int screenHeight = point.y;
        int[] location = new int[2];
        view.getLocationOnScreen(location);
        return location[0] < screenWidth && location[1] < screenHeight;
    }
}
